﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Collections;

namespace MaxStudio.Concrete.DBUtility
{
    public class QIMSCache
    {
        private static readonly QIMSCache _QIMSCache = new QIMSCache();

        private static readonly Cache _cache;

        static QIMSCache()
        {
            _cache = HttpRuntime.Cache;
        }

        public static QIMSCache getCache() {
            return _QIMSCache;
        }

        public static void clearAll()
        {
            IDictionaryEnumerator enumerator = _cache.GetEnumerator();
            while (enumerator.MoveNext())
            {
                _cache.Remove(enumerator.Key.ToString());
            }
        }

        public static object get(String key)
        {
            return _cache[key];
        }

        public static void insert(String key, Object obj)
        {
            _cache.Insert(key, obj);
        }

        public static void remove(String key)
        {
            _cache.Remove(key);
        }
    }
}
